<template>
  <view class="item" v-for="(lottery, index) in lotteries" :class="type[index]">
    <view class="header"> {{lottery.phase}}期 </view>
    <div class="lottery-numbers">
      <span class="lottery-number" v-for="(ball) in lottery.nums">{{ball}}</span>
    </div>
  </view>
</template>

<script setup>
import {onMounted, ref} from "vue";
import {ballApi} from "../../../api/business/ball/ball-api";
//双色球开奖列表
const lotteries = ref([
  {
    "id": 2634,
    "phase": 24051,
    "red1": 5,
    "red2": 9,
    "red3": 13,
    "red4": 20,
    "red5": 23,
    "red6": 28,
    "blue": 6
  },
  {
    "id": 2633,
    "phase": 24050,
    "red1": 1,
    "red2": 3,
    "red3": 7,
    "red4": 10,
    "red5": 22,
    "red6": 33,
    "blue": 2
  },
  // ...其他彩票信息
])

onMounted(()=>{
  ballApi.happy8().then(res =>{
    if(res.ok){
      lotteries.value = res.data;
    }
  });
});

const type = [
  'primary',
  'warning',
  'info',
  'danger',
  'success'
];
</script>

<style lang="scss" scoped>
.item {
  width: 700rpx;
  margin: 20rpx auto 0;
  background: #ffffff;
  border-radius: 12rpx;
  box-shadow: 0px 3px 4px 0px rgba(24, 144, 255, 0.06);
  padding: 20rpx 20rpx 20rpx;
  box-sizing: border-box;
  border-left: 8rpx solid #4f4d4d;
  &.primary {
    border-color: #007ff2;
  }
  &.warning {
    border-color: #E6A23C;
  }
  &.info {
    border-color: #909399;
  }
  &.danger {
    border-color: #F56C6C;
  }
  &.success {
    border-color: #67C23A;
  }

  .header {
    display: flex;
    justify-content: space-between;
    padding-bottom: 20rpx;
    border-bottom: 1rpx solid #ededed;
    margin-bottom: 19rpx;
    font-size: 34rpx;
    color: #444;
  }

  .lottery-numbers {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
  }

  .lottery-number {
    display: inline-block;
    padding: 5px ;
    margin: 4px 4px;
    background-color: #ff3924;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    line-height: 18px;
    text-align: center;
    font-weight: bold;
    font-size: 15px;
    color: white;
  }

  .footer {
    display: flex;
    justify-content: space-between;
    font-size: 28rpx;

    .footer-left {
      color: #000000; /* Changed the color to black */
    }

    .footer-state {
      &.primary {
        border-color: #007ff2;
      }
      &.warning {
        border-color: #E6A23C;
      }
      &.info {
        border-color: #909399;
      }
      &.danger {
        border-color: #F56C6C;
      }
      &.success {
        border-color: #67C23A;
      }
      color: #4f4d4d;
    }
  }
}


</style>
